Repository navigation
fix: stop reading the filesystem from ordinary string parameters - #3
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0897955 to
59e2ad0
Compare
The SDK walked every string in the params of
run(),imageUpload()andmediaStorage(), and replaced any string that was an exact path to a readableregular file with that file's base64 contents. There was no field allowlist, so
positivePromptwas treated the same asseedImage: an application thatforwarded user text into
run()could be made to read local files and send themupstream.
The README already described the contract it was meant to honor, and did not:
"and prompts pass through untouched".
What changes
The recursive walk is gone. A string you pass is sent as that string.
A local file now travels only when the caller asks for it, which is the property
that was missing: the filesystem is reached by naming a function, never by a
value happening to look like a path.
The explicit way, unchanged
file_to_base64andfile_to_data_urialready took astr, aPath,bytesor a file-like, so the migration is a drop-in:
file_to_base64returns raw base64 with no prefix, which is byte-for-byte whatthe implicit encoder put on the wire.
Breaking
Passing a path straight to a media parameter no longer works. That behavior was
advertised in the README, so this is a breaking change for anyone using it
deliberately, shipped as a patch because leaving people on a vulnerable version
is worse. The migration is the one line above.
Verification
the transport as that path, and the file's base64 appears nowhere in the body.
Asserted at top level and nested in an array.